package page.Beans;

import java.sql.SQLException;

import basicTypes.RAClient;

public class insertUser {
	private String name;
	private String user;
	private String psw;
	private int permission;
	
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getPsw() {
		return psw;
	}
	public void setPsw(String psw) {
		this.psw = psw;
	}
	public int getPermission() {
		return permission;
	}
	public void setPermission(int permission) {
		this.permission = permission;
	}
	
	public String insertUsr(loginBean x){
		boolean var;
		if(permission == 1)
			var = true;
		else
			var = false;
		RAClient novo = new RAClient(10, name, var, user);
		try{
			x.getBd().db_addClient(x.getUser(), novo,psw);
		}
		catch(SQLException e){
			System.out.println(e.getMessage());
			return "fail";
		}
		
		return "suc";
		
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}
